LinuxQMISDK-Lite  SLQS04.00.27
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
MbimTransport.h File Reference

Go to the source code of this file.

Data Structures

struct  MbimTransport
 

Macros

#define MBIM_UUID_SIZE   16
 
#define MBIM_MAX_CIDS   64
 
#define MBIM_MAX_CTRL_TRANSFER   4096
 
#define MBIM_COMMAND_TYPE_QUERY   0
 
#define MBIM_COMMAND_TYPE_SET   1
 
#define MBIM_STATUS_SUCCESS   0
 
#define MBIM_STATUS_FAILURE   2
 

Typedefs

typedef struct MbimTransport MbimTransport
 

Functions

int MbimTransport_Initialize (MbimTransport *pThis, char *devicePath, uint32_t maxExpectedInformationLength)
 
void MbimTransport_ShutDown (MbimTransport *pThis)
 
int MbimTransport_SendCommand (MbimTransport *pThis, const uint8_t *deviceServiceId, uint32_t cid, uint32_t commandType, uint8_t *informationBuffer, uint16_t informationBufferLength, MbimTransaction *pTransaction)
 
uint32_t MbimTransport_GetNextTransactionId (MbimTransport *pThis)
 
void MbimTransport_CancelTransaction (MbimTransport *pThis, uint32_t transactionId)
 
void MbimTransport_AttachIndicator (MbimTransport *pThis, MbimIndicator *pIndicator)
 
void MbimTransport_DetachIndicator (MbimTransport *pThis, MbimIndicator *pIndicator)
 

Macro Definition Documentation

#define MBIM_COMMAND_TYPE_QUERY   0

MBIM query command

#define MBIM_COMMAND_TYPE_SET   1

MBIM set command

#define MBIM_MAX_CIDS   64

Max CIDs per device service. Chosen with some head-room. Current max is 25.

#define MBIM_MAX_CTRL_TRANSFER   4096

This value should be determined at run-time.

#define MBIM_STATUS_FAILURE   2

Standard MBIM return code failure.

#define MBIM_STATUS_SUCCESS   0

Standard MBIM return code success.

#define MBIM_UUID_SIZE   16

Number of bytes in a MBIM device service's UUID

Typedef Documentation

typedef struct MbimTransport MbimTransport

This structure abstracts a MBIM transport layer. It is responsible for applying MBIM headers to packets destined for MBIM device services and forwarding them to the device. It is responsible for receiving MBIM packets from the device. On the basis of MBIM headers, it assembles multi-fragment responses and indications and delivers them back to user.

Parameters
deviceFd
  • File descriptor of device.
shutdownFd
  • Event descriptor. Used to signal read thread to terminate.
writeLock
  • Provides mutual exclusion for write operations.
readThread
  • Thread responsible for reading from device.
transactionId
  • MBIM transaction ID. Upper limit 0xffffffff. Never 0. Increments for each transaction.
transactionIdLock
  • Mutex to make transactionId access thread-safe.
transactionList
  • Head of linked list of outstanding transactions.
transactionListLock
  • Provides thread safety for the transaction list.
pIncomingMessage
  • Private workspace to assemble incoming information fragments.
indicatorList
  • Head of linked list of indicators which are called when MBIM indications are received.
indicatorListLock
  • Provides thread safety for the indicators list.

Function Documentation

void MbimTransport_AttachIndicator ( MbimTransport pThis,
MbimIndicator pIndicator 
)

Attaches a MBIM indicator to this MBIM transport object.

Parameters
[in]pThisThe primary object of this call.
[in]pIndicatorIndicator to be attached.
void MbimTransport_CancelTransaction ( MbimTransport pThis,
uint32_t  transactionId 
)

Cancel an outstanding MBIM transaction.

Parameters
[in]pThisThe primary object of this call.
[in]transactionIdID of transaction to be cancelled.
void MbimTransport_DetachIndicator ( MbimTransport pThis,
MbimIndicator pIndicator 
)

Detaches a MBIM indicator to this MBIM transport object.

Parameters
[in]pThisThe primary object of this call.
[in]pIndicatorIndicator to be detached.
uint32_t MbimTransport_GetNextTransactionId ( MbimTransport pThis)

Returns next transaction ID for MBIM transport.

Parameters
[in]pThisThe primary object of this call.
Returns
transaction ID
int MbimTransport_Initialize ( MbimTransport pThis,
char *  devicePath,
uint32_t  maxExpectedInformationLength 
)

Initialize this MBIM transport object.

Parameters
[in]pThisThe primary object of this call.
[in]devicePathAbsolute path to device.
[in]maxExpectedInformationLengthMaximum expected length of information content.
Returns
0 on success, < 0 on failure.
Note
maxExpectedInformationLength is used to allocate a buffer for assembling fragments for incoming command responses and indications.
int MbimTransport_SendCommand ( MbimTransport pThis,
const uint8_t *  deviceServiceId,
uint32_t  cid,
uint32_t  commandType,
uint8_t *  informationBuffer,
uint16_t  informationBufferLength,
MbimTransaction pTransaction 
)

Send a MBIM command to the device and return immediately.

Parameters
[in]pThisThe primary object of this call.
[in]deviceServiceIdDevice service UUID which is recipient of command.
[in]cidCommand ID (CID) which is specific to that device service.
[in]commandType1 = set, 0 = get.
[in]informationBufferBuffer of information content.
[in]informationBufferLengthSize in bytes of information content.
[in]pTransactionTransaction object which will track the command/response.
Returns
0 on success, < 0 on failure.
Note
pTransaction must have been initialized with MbimTransaction_Initialize prior to this call.
void MbimTransport_ShutDown ( MbimTransport pThis)

Shut down this MBIM transport object.

Parameters
[in]pThisThe primary object of this call.

Copyright (c) 2011-2015 Sierra Wireless, Inc. All rights reserved